package com.kele.service.impl;

import com.kele.mapper.SectionMapper;
import com.kele.model.entity.Section;
import com.kele.model.his.HisSection;
import com.kele.service.SectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @Author: Kele
 * @CreateDate: 2022/8/5 10:56
 * @Version:
 */
@Service
public class SectionServiceImpl implements SectionService {

    @Autowired
    private SectionMapper sectionMapper;

    @Override
    public int addSection(List<HisSection> sections) {
        List<Section> insertData = new ArrayList<>();
        for (HisSection section : sections) {
            Section s = new Section();
            s.setHisId(section.getHisId());
            s.setName(section.getName());
            insertData.add(s);
        }

        return sectionMapper.addSections(insertData);
    }
}
